<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="css/style.css" />
<link type="text/css" rel="stylesheet" href="css/layout.css" />
<title>Quản lý chuyên mục !</title>
</head>

<body>
<?php 
include("menu.php");
include("../include/config.php"); 
?>
<div id="head-noidung">
	<div id="head-main">
<?php
	$id=$_REQUEST["id"];
	$sql="SELECT * FROM category WHERE id=$id";
	$rs=mysql_query($sql);
	$rw=mysql_fetch_array($rs);
	$id=$_REQUEST["id"];
?>
	<form name="categoryedit" action="" method="post">
	<table class="classtable" style="width:45%;">
	<tbody>
	<tr>
	<td>Tên chuyên mục</td>
	<td><input name="category" type="text" size="35" style="float:left;" value="<?php echo $rw['name'];?>"></td>
	</tr>
	
	<tr>
	<td>Số thứ tự</td>
	<td><input name="sttcategory" type="text" size="5" style="float:left;" value="<?php echo $rw['stt'];?>"></td>
	</tr>
	
	<tr>
	<td>Hoạt động</td>
	
	<td> 	<select name="status">
				<option value="1" <?php echo ($rw['status'] == 1)?"selected='selected'":""?>> Hiện </option>
				<option value="0" <?php echo ($rw['status'] == 0)?"selected='selected'":""?>> Ẩn </option>
			</select></td> 
	</tr>
	<tr>
	<td></td>
	<td><input type="submit" name="categoryedit" value="Cập nhật"/>
	<input type="hidden" name="id" value="<?php echo $id?>" />
	
	</td>
	</tr>
	
	</tbody>
	</table>
	</form>
	
	<?php 
	 if(isset($_REQUEST["categoryedit"]))
	 {
	 	$category=$_REQUEST["category"];
		$stt=$_REQUEST["sttcategory"];
		$id=$_REQUEST["id"];
		$status=$_REQUEST["status"];

		$sql2="UPDATE category SET name='" . addslashes($category) . "',stt=$stt,status=$status WHERE id=$id";
					
		mysql_query($sql2);
		echo ("Cập nhật thành công");
	 
?> <a class="copyrighta" href="category.php">Trở lại danh sách</a>
<?php } ?>
		</div>	
</div>

<?php include("images/cherry/footer.php"); ?>

</body>
</html>
